home *** CD-ROM | disk | FTP | other *** search
- Path: khyber.ncc.up.pt!usenet
- From: Luis Miguel Pinho <lmp@tormentas.fe.up.pt>
- Newsgroups: comp.lang.c
- Subject: Re: question on pass-by-reference
- Date: Mon, 22 Jan 1996 15:03:24 +0000
- Organization: ISR-GAI
- Message-ID: <3103A73C.41C6@tormentas.fe.up.pt>
- References: <4dha4j$4qg@shrike.depaul.edu>
- NNTP-Posting-Host: tormentas.fe.up.pt
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b3 (X11; I; AIX 2)
-
- Kazuki Murakami wrote:
- >
- > I have a question on pass-by-reference.
- > Here is a problem, I want to set array of unsigned short number to be all 0 using a function.
- > here is what set looks like:
- > typedef unsigned short USHORT;
- > typedef USHORT SET[32];
- >
- > here is the setInit, which will initialize set to be 0,
- > void setInit (SET *s)
- > {
- > int i;
- >
- > for (i=0; i<32; i++)
- > {
- > *s[i] = 0;
- ^^^^^^^^^^^^^^
- try (*s)[i]=0;
- > }
- > }
- >
- > here is the calling function.
- > setInit(&set1); setInit(&set2);
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- first you have to define:
- SET set1,set2;
-
- >
- > I think there is somthing wrong in "setInit" function but I cannot seem to figure out what that is.
- > If somebody can figure out what that is or some other way of initializing "SET s" please give
- > me a e-mail.
- > e-mail address is kmurakam@shrike.edpaul.edu
- >
- > Thank you
- >
- > Kazuki Murakami
-
- --
- **********************************************************************
- Luis Miguel Pinho Tel: 351-2-5502372
- Largo da Lapa, 14, 2oE 351-2-2041815
- 4050 Porto http://tormentas.fe.up.pt/lmp
- Portugal E-mail: lmp@tormentas.fe.up.pt
- **********************************************************************
-